package com.winz.cultureapp.activity;

import android.content.Intent;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.winz.cultureapp.R;
import com.winz.cultureapp.base.BaseAppCompatActivity;
import com.winz.cultureapp.constants.Constants;
import com.winz.cultureapp.entity.RecordActivityListBean;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * 管理员 -- 活动订单详情
 */
public class AdminActivityDesActivity extends BaseAppCompatActivity {
    @BindView(R.id.tv_top_title)
    TextView mTv_top_title;
    @BindView(R.id.tv_no)
    TextView mTv_no;
    @BindView(R.id.tv_order_time)
    TextView mTv_order_time;
    @BindView(R.id.iv_pic)
    ImageView mIv_pic;
    @BindView(R.id.tv_price)
    TextView mTv_price;
    @BindView(R.id.tv_title)
    TextView mTv_title;
    @BindView(R.id.tv_location)
    TextView mTv_location;
    @BindView(R.id.tv_time)
    TextView mTv_time;
    @BindView(R.id.tv_tell)
    TextView mTv_tell;
    @BindView(R.id.tv_type)
    TextView mTv_type;
    private RecordActivityListBean.DataBean.ListBean mData;

    @Override
    protected int contentView() {
        return R.layout.activity_admin_activity_des;
    }

    @Override
    protected void initViews() {
        mTv_top_title.setText("订单详情");
    }

    @Override
    protected void loadDatas(Intent intent) {
        if (intent != null){
            if (intent.getExtras() != null){
                mData = (RecordActivityListBean.DataBean.ListBean) intent.getExtras().getSerializable(Constants.KEY.ADMIN.DETAIL);
                mTv_no.setText("订单号：" + mData.orderNumber);
                mTv_order_time.setText("订单时间："+mData.createTime);
                Glide.with(this)
                        .load(mData.imageUrl)
                        .error(R.drawable.pic_default)
                        .into(mIv_pic);
                mTv_price.setText("￥ " + mData.seatMoney);
                mTv_title.setText(mData.activityName);
                mTv_location.setText("地址：" + mData.address);
                mTv_time.setText("时间：" + mData.startTime.substring(0,16)+" - " + mData.endTime.substring(0,16));
                mTv_tell.setText("座位：" + mData.seatDesc);

                mTv_type.setText(mData.useStatus == 0?"未使用":mData.useStatus == 1?"已使用":"已过期");
                mTv_type.setTextColor(getResources().getColor(mData.useStatus == 0?R.color.base_color:mData.useStatus == 1?R.color.dodgerblue:R.color.icon_red));
            }
        }
    }

    @OnClick(R.id.fl_back)
    public void onClick() {
        finish();
    }
}
